Unit Printcolor;

interface
uses
graph,printer,globvar;

procedure PrintGraph(mode,direction  :  integer);

Implementation

Procedure PrintGraph(Mode, Direction : integer);

const   ESC=#$1B;

var ll,ii,jj,kk,nn,aa,mmsb,llsb,MMaxX,MMaxY  : Integer;


mm    :   array[0..639,0..6] of integer;
cor   :   array[0..6] of boolean;



begin
    MMaxX:=639;
    MMaxY:=442;




 (*   writeLn(lst,'                                                               ');
    wRITElN(LST);
    WriteLn(lst,'                                                      ');
    WriteLn(lst,'                                               ');
    WriteLn(lst,'                                                 ');*)



  write(lst,#27,#64);



{ WriteLn(lst,'        Dr. Carlos Roberto DeFaria - Dra. Susanie Caldas');
  WriteLn(lst,'                       Neurofisiologia Clinica');
  WriteLn(lst,'                           C E M E D I');
  WriteLn(lst,'          Rua 2 No. 657 Setor Oeste 74110-130 Goiania GO');
  WriteLn(lst,'                   TEL (062) 225 2326/229 2462');}

  For ii:=1 to 4 do writeLN(lst);
  write(lst,#27,#52);
  write(lst,#27,#119,char(1),#27,#87,char(1));
  write(lst,#27,#114,char(0),#27,#107,char(4));
  {WriteLn(lst,'            N E U R O L A B');
  write(lst,#27,#119,char(0),#27,#87,char(0));
  write(lst,#27,#114,char(0));
  write(lst,#27,#70);
  writeLn(lst,'            Dra. Terezinha E.N. Prince - Dr. Jose Alcyr Nunes');
  WriteLn(lst,'                   Neurologia e Eletroneuromiografia');
  WriteLn(lst,'          Rua Francisco A. Coutinho 238 - Cambui - Campinas SP');
  WriteLn(lst,'                        TEL (0192) 52 2526');}



(*  WriteLn(lst,'   N E U R O L A B');
  write(lst,#27,#119,char(0),#27,#87,char(0));
  write(lst,#27,#114,char(0));
  writeLn(lst,'      Dra. Terezinha E.N. Prince - Dr. Jose Alcyr Nunes');
  WriteLn(lst,'      Neurologia e Eletroneuromiografia');
  WriteLn(lst,'      Rua Francisco A. Coutinho 238 - Cambui - Campinas SP');
  WriteLn(lst,'      TEL (0192) 52 2526');*)

{  WriteLn(lst,'   C E M E D I');
  write(lst,#27,#119,char(0),#27,#87,char(0));
  write(lst,#27,#114,char(0));
  WriteLn(lst,'      Neurofisiologia Clinica');
  writeLn(lst,'      Dr Carlos R. DeFaria - Dra Susanie Caldas');
  WriteLn(lst,'      Rua 2 No. 657 Setor Oeste 74110-130 Goiania GO');
  WriteLn(lst,'      TEL (062) 225 2326/229 2462');}


(*WriteLn(lst,'   N E U R O C L I N I C A');
  write(lst,#27,#119,char(0),#27,#87,char(0));
  write(lst,#27,#114,char(0));
{ writeLn(lst,'      Dra. Terezinha E.N. Prince - Dr. Jose Alcyr Nunes');}
  WriteLn(lst,'      Neurologia - Neurofisiologia Clinica');
  WriteLn(lst,'      Rua Joao Balbi 542 - Belem - Para');
  WriteLn(lst,'      TEL (091) 224 0120');*)




(*  WriteLn(lst,'   Neuroclinica - Feira de Santana');

  write(lst,#27,#119,char(0),#27,#87,char(0));
  write(lst,#27,#114,char(2));
{  writeLn(lst,'      Dra. Terezinha E.N. Prince - Dr. Jose Alcyr Nunes');}
{  WriteLn(lst,'      Neurologia - Neurofisiologia Clinica');}
{  WriteLn(lst,'      Neuroclinica - Feira de Santana - BAHIA');}
  WriteLn(lst,'      Rua Castro Alves 894 - BAHIA');

  WriteLn(lst,'      TEL (075) 623 9088');*)



  WriteLn(lst);

{  write(lst,#27,#64);}
{  write(lst,#27,#114,char(2),'                                       (__ Normal,');
  write(lst,#27,#114,char(1),'__Anormal,');
  writeLn(lst,#27,#114,char(0),'__Question.)');}

     SetViewPort(0,15,MMaxX,MMaxY,false);
     {write(lst,esc,'A',char(8));}
      write(lst,esc,'A',char(8));
     { write(lst,#28,#67,#66);}{alta resolucao canon}
   case direction of
   1 : begin
           LLsb:=MMaxX and $00FF;
           MMsb:=MMaxX shr 8;
           for jj:=0 to MMaxY div 8 do
              begin{ler tela, selecionar cores.}
               for nn:=0 to 6 do cor[nn]:=false;
                for ii:=0 to MMaxX do
                begin
                for nn:=0 to 6 do mm[ii,nn]:=0;
                   for kk:=0 to 7 do begin
                  for nn:=0 to 6 do begin
                     mm[ii,nn]:=mm[ii,nn] shl 1;
                      if mm[ii,nn]<>0 then cor[nn]:=true;
                  end;
                   ll:=getpixel(ii,jj*8+kk);
                     case ll of
                    1 : begin
                           inc(mm[ii,2]);
                           inc(mm[ii,3]);
                        end;
                    2 : inc(mm[ii,6]);
                    3 : inc(mm[ii,2]);
                    4 : inc(mm[ii,1]);
                    5 : inc(mm[ii,3]);
                    6 : inc(mm[ii,5]);
                    14: inc(mm[ii,4]);

                    7,8,10,15: inc(mm[ii,0]);
                   end;
              end;
              end;
            for nn:=0 to 6 do
            if cor[nn] then
             begin
                 write(lst,#27,#114,char(nn));
                  write(lst,esc,'*',char(mode),char(llsb),char(MMsb));
                  for aa:=0 to MmaXX do write(lst,char(mm[aa,nn]));
                  write(lst,#$0D);
             end;
           write(lst,#$0A);

           end;
        end;

  (*   2:begin
      LLsb:=MMaxY and $00FF;
      MMsb:=MMaxY shr 8;
      jj:=0;
      repeat
        write(lst,esc,'*',char(mode),char(llsb),char(mmsb));
        for ii:=MMaxY downTo 0 do
        begin
          mm:=0;
          for kk:=0 to 7 do begin
            mm:=mm shl 1;
            If (getPixel(jj+kk,ii)=15)
            or (getPixel(jj+kk,ii)=7)
            or (getPixel(jj+kk,ii)=8)
            or (getPixel(jj+kk,ii)=6)
            then inc (mm);
            end;
            write(lst,char(mm));
          end;
          write(lst,#$0D,#$0A);
          inc(jj,8);
          until jj>=MMaxX-1;
      end;*)

end;


write(lst,#$0C);
{write(lst,#12,#0);}
SetViewPort(InitX,InitY,FinX,FinY,clipOn);
end;
end.